#!/bin/bash
export PATH=/bin:/usr/bin:/usr/externals/bin:/usr/sbin:/usr/local/bin:/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/bin:/usr/externals/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/usr/bin:/usr/java/latest/bin:/opt/puppetlabs/bin:/root/bin:/usr/java/latest/bin
users=`lid -g buaa|awk -F'(' '{print $1}'`
echo class localaccounts::accounts {
for user in $users
do
    uid=`id -u $user`
    groups=`id -G $user`
    groups=${groups//290/1290}
    shell=`getent passwd $user | cut -d: -f7`


        echo "  user { '$user':"
        echo "    ensure  => 'present',"
        echo "    comment => '$user',"
        echo "    gid     => '1010',"
        echo "    home    => '/home/$user',"
        echo "    shell   => '$shell',"
        echo "    uid     => '$uid',"
        echo "  }"
done
        #echo "  group { 'buaa':"
        #echo "    ensure  => 'present',"
        #echo "    gid     => '1010',"
        #echo "  }"
        echo "}"
